<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}


</head>
<body>
{include file='public/header'/}
<!------------------导航-------------------------->
<section id="content">
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgr15 mgl15">
            <ol class="breadcrumb">
                <li>当前位置是:</li>
                <li>
                    <a href="{:url('cardus/cardinfo',['card_id'=>$card['card_id']])}">会员卡管理</a>
                </li>
                <li>
                    <a href="javascript:history.back();">会员等级</a>
                </li>
                <li class="active" style="color: #02b87f;">添加会员等级</li>
            </ol>
        </div>
        <div class="panel mgr15 mgl15">
            <form class="form-horizontal adminex-form" action='' method="post">
            <div class="panel-heading addCharts" style="background:#ededed;">
                会员等级
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-sm-2 col-sm-2 control-label">等级名称：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name='live_title' id="live_title" placeholder="">
                        <div class="error">请输入等级名称，例如白银会员、黄金会员等</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 col-sm-2 control-label">等级：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name='live' placeholder="" id="live">
                        <div class="error">请输入等级数字，例如：1</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 col-sm-2 control-label">所需积分：</label>
                    <div class="col-sm-10">
                        <input type="text" value="0" class="form-control" name='bonus' id="bonus" oninput="value = value.replace(/[^\d.]/g, '')" placeholder="">
                        <div class="error">当用户积分达到该数值时则升级为当前等级</div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-sm-2 control-label">折扣系数(%)：</label>
                    <div class="col-sm-10">
                        <input type="text" value="100" class="form-control" id="discount" oninput="value = value.replace(/[^\d.]/g, '')" name='discount' placeholder="">
                        <div class="error">如打8折,则填写80</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 col-sm-2 control-label">奖励积分：</label>
                    <div class="col-sm-10">
                        <input type="text" value="0" class="form-control" oninput="value = value.replace(/[^\d.]/g, '')" name='reward_bonus' id="reward_bonus" placeholder="">
                        <div class="error">达到该等级后,会员会增加对应数额的积分</div>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 col-sm-2 control-label">奖励储值：</label>
                    <div class="col-sm-10">
                        <input type="text" value="0" class="form-control" oninput="value = value.replace(/[^\d.]/g, '')" name='reward_balance' id="reward_balance" placeholder="">
                        <div class="error">达到该等级后,会员会增加对应数额的储值</div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-sm-2 control-label">会员权益：</label>
                    <div class="col-sm-10">
                        <textarea name="welfare" class="form-control" style="resize: none;" rows="3" id="welfare"></textarea>
                        <div class="error"></div>
                    </div>
                </div>

            </div>
            <div class="panel-footer">
                <button type="button" class="btn btn-primary" id="add">保存</button>
            </div>
            </form>
        </div>
        {include file='public/footer'/}
    </div>
</section>
</body>
<script>
    //       提交数据
    $("#add").click(function(){
        var live_title = $("#live_title").val();
        var live = $("#live").val();
        var bonus = $("#bonus").val();
        var discount = $("#discount").val();
        var reward_bonus = $("#reward_bonus").val();

        var welfare = $("#welfare").val();
        var reward_balance = $("#reward_balance").val();

        if(live_title == ""){
            layer.alert("请输入等级名称");
            return false;
        }
        if(live == ""){
            layer.alert("请输入等级");
            return false;
        }
        if(bonus == ""){
            layer.alert("请输入所需积分");
            return false;
        }
        if(discount == ""){
            layer.alert("请输入折扣系数");
            return false;
        }
        if(reward_bonus == ""){
            layer.alert("请输入奖励积分");
            return false;
        }
        if(reward_balance == ""){
            layer.alert("请输入奖励储值");
            return false;
        }
        if(welfare == ""){
            layer.alert("请输入会员权益");
            return false;
        }
        $(".adminex-form").submit();
    });
</script>
<!--一级和二级类目选择-->
<script type="text/javascript">

</script>

</html>
